<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">

        姓名(文本)：<input type="text" v-model="name">
        <br><br>
        性别(单选按钮)：
        <input name="sex" type="radio" value="男" v-model="sex">男
        <input name="sex" type="radio" value="女" v-model="sex">女
        <br><br>
        技能(多选框)：
        <input type="checkbox" name="skills" value="java" v-model="skills">Java开发
        <input type="checkbox" name="skills" value="vue" v-model="skills">Vue.js开发
        <input type="checkbox" name="skills" value="python" v-model="skills">Python开发
        <br><br>
        城市(下拉框)：
        <select name="citys" v-model="my_city">
            <option :value="city_data.value" v-for="city_data in city">{{ city_data.name }}</option>
        </select>
        <br><br>
        说明(多行文本)：<textarea cols="30" rows="5" v-model="text"></textarea>
        <br><br>
        <button type="submit" @click="sub">提交</button>

    </div>
</body>
<script src="./vue.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            msg: 'devtools的安装',
            name: "",
            sex: "男",
            skills: ["java", "python"],
            my_city: "maoming",
            city: [
                {
                    value: "maoming",
                    name: "茂名"
                },
                {
                    value: "sz",
                    name: "深圳"
                },
                {
                    value: "st",
                    name: "汕头"
                }
                {
                    value: "gz",
                    name: "广州"
                }
                {
                    value: "hz",
                    name: "惠州"
                }
                {
                    value: "sw",
                    name: "汕尾"
                }
                {
                    value: "zj",
                    name: "湛江"
                }],
            my_city: 'maoming',
            text: ''
        },
        methods: {
            sub() {
                let datalist = {
                    username: this.name,
                    usersex: this.sex,
                    userskills: this.skills,
                    userCity: this.my_city,
                    user_text: this.text,
                }
                console.log(datalist);
            }
        }
    })
</script>

</html>